<!DOCTYPE html>
<html lang="zh">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>Hugo日常使用优化 | Hts0000 | 个人博客</title><meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="noodp" />
<meta name="Description" content="Hts0000 | 个人博客">
<link rel="prev" href="https://hts0000.github.io/2020/02/%E5%9F%BA%E4%BA%8Ehugo%E5%BF%AB%E9%80%9F%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/" />
<link rel="canonical" href="https://hts0000.github.io/2020/02/hugo%E6%97%A5%E5%B8%B8%E4%BD%BF%E7%94%A8%E4%BC%98%E5%8C%96/" />
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png">
<link rel="manifest" href="/site.webmanifest">
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<meta name="twitter:card" content="summary"/>
<meta name="twitter:title" content="Hugo日常使用优化"/>
<meta name="twitter:description" content=""/>
<script type="application/ld+json">
    {
    "@context": "http://schema.org",
    "@type": "BlogPosting",
    "headline": "Hugo日常使用优化",
    "mainEntityOfPage": {
        "@type": "WebPage",
        "@id": "https:\/\/hts0000.github.io\/2020\/02\/hugo%E6%97%A5%E5%B8%B8%E4%BD%BF%E7%94%A8%E4%BC%98%E5%8C%96\/"
    },
    
        "image": {
            "@type": "ImageObject",
            "url": "https:\/\/hts0000.github.io\/cover.png",
            "width":  800 ,
            "height":  600 
        },
    
    "genre": "posts",
    
        "keywords": "hugo, 分享",
    
    "wordcount":  1428 ,
    "url": "https:\/\/hts0000.github.io\/2020\/02\/hugo%E6%97%A5%E5%B8%B8%E4%BD%BF%E7%94%A8%E4%BC%98%E5%8C%96\/",
    
        "datePublished": "2020-02-16T19:01:40\x2b08:00",
    
    
        "dateModified": "2020-02-16T19:01:40\x2b08:00",
    
    
        "license": "This work is licensed under a Creative Commons Attribution-NonCommercial 4.0 International License.",
    
    
        "publisher": {
            "@type": "Organization",
            "name": "XXXX",
            "logo": {
            "@type": "ImageObject",
            "url": "https:\/\/hts0000.github.io\/logo.png",
            "width":  127 ,
            "height":  40 
            }
        },
    
    
    "description": ""
    }
    </script>
<link rel="stylesheet" href="/css/style.min.css">
<link rel="stylesheet" href="/css/lib/fontawesome-free/all.min.min.css">

<link rel="stylesheet" href="/css/lib/animate/animate.min.min.css">

    </head>
    <body>
        <script>
            window.isDark = (window.localStorage && window.localStorage.getItem('theme')) === 'dark';
            window.isDark && document.body.classList.add('dark-theme');
        </script>
        <div class="wrapper">
            <nav class="navbar">
    <div class="navbar-container">
        <div class="navbar-header animated bounceIn">
            <a href="https://hts0000.github.io/">Hts0000 | 个人博客</a>
        </div>
        <div class="navbar-menu">
            
            
                <a class="menu-item" href="https://hts0000.github.io/posts" title="">文章</a>
            
                <a class="menu-item" href="https://hts0000.github.io/tags" title="">标签</a>
            
                <a class="menu-item" href="https://hts0000.github.io/categories" title="">分类</a>
            
                <a class="menu-item" href="https://hts0000.github.io/about" title="">关于</a>
            
            <a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw"></i></a>
        </div>
    </div>
</nav>
<nav class="navbar-mobile">
     <div class="navbar-container">
        <div class="navbar-header">
            <div class="navbar-header-title animated bounceIn">
                <a href="https://hts0000.github.io/">Hts0000 | 个人博客</a>
            </div>
            <div class="menu-toggle" id="menu-toggle">
                <span></span><span></span><span></span>
            </div>
        </div>
        <div class="navbar-menu" id="mobile-menu">
            
            
                <a class="menu-item" href="https://hts0000.github.io/posts" title="">文章</a>
            
                <a class="menu-item" href="https://hts0000.github.io/tags" title="">标签</a>
            
                <a class="menu-item" href="https://hts0000.github.io/categories" title="">分类</a>
            
                <a class="menu-item" href="https://hts0000.github.io/about" title="">关于</a>
            
            <a href="javascript:void(0);" class="theme-switch"><i class="fas fa-adjust fa-rotate-180 fa-fw"></i></a>
        </div>
    </div>
</nav><main class="main">
                <div class="container">
                    
    
    
    

    <article class="post-warp">
        <h1 class="post-title animated flipInX">Hugo日常使用优化</h1>

        <div class="post-meta">
            <div class="post-meta-main">
                <a class="author" href="https://hts0000.github.io/" rel="author"><i class="fas fa-user-circle fa-fw"></i>hts0000&nbsp;</a>
                <span class="post-category">
                        收录于
                        <i class="far fa-folder fa-fw"></i><a href="https://hts0000.github.io/categories/%E5%88%86%E4%BA%AB/">分享</a>
                            
                    </span>
            </div>
            <div class="post-meta-other">
                <i class="far fa-calendar-alt fa-fw"></i><time datetime=2020-02-16>2020-02-16</time>&nbsp;
                <i class="fas fa-pencil-alt fa-fw"></i>约 1428 字&nbsp;
                <i class="far fa-clock fa-fw"></i>预计阅读 3 分钟&nbsp;</div>
        </div>

        

        

        <div class="post-content">
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            
            <p>转载请注明出处：<code>https://hts0000.github.io/</code></p>
<p>欢迎与我联系：<code>hts_0000@sina.com</code></p>
<a class="post-dummy-target" id="1-引言"></a><h1>1 引言</h1>
<p>本文用于记录日常使用hugo的优化建议，阅读时长10分钟。</p>
<p><strong>适用于以下人员：</strong></p>
<ul>
<li>已经搭建好Hugo博客</li>
<li>希望使用图床功能</li>
<li>希望自己的博客能在百度和谷歌上搜索到</li>
</ul>
<p><strong>本文将从以下几点进行优化：</strong></p>
<ul>
<li>使用GitHub作为博文的图床</li>
<li>让百度和谷歌收录站点</li>
</ul>
<a class="post-dummy-target" id="2-使用github作为图床储存图片"></a><h1>2 使用GitHub作为图床储存图片</h1>
<a class="post-dummy-target" id="什么是图床"></a><h2>什么是图床</h2>
<p>图床是一个专门存放图片的服务器，使用图床可以让我们的博客直接从网上获取图片，而无需管理本地图片路径，让我们获得更好的博文书写体验。</p>
<a class="post-dummy-target" id="优雅的使用图床"></a><h2>优雅的使用图床</h2>
<p>方案为：<code>VsCode+PicGo插件+GitHub</code>。</p>
<p>VsCode用于书写博客文章，PicGo插件用于快速生成网络图片链接，GitHub作为图片服务器存放图片。</p>
<a class="post-dummy-target" id="操作步骤如下"></a><h3><strong>操作步骤如下：</strong></h3>
<a class="post-dummy-target" id="1安装vscode"></a><h3>1.安装VsCode</h3>
<p>点击<a href="https://code.visualstudio.com/Download"><code>VsCode</code></a>即可前往下载界面。安装十分简单，不再赘述。</p>
<a class="post-dummy-target" id="2下载picgo插件"></a><h3>2.下载PicGo插件</h3>
<p>打开VsCode，在左侧的扩展管理中输入PicGo下载插件。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216161051.png" alt="下载PicGo插件" title="下载PicGo插件"></p>
<a class="post-dummy-target" id="3创建github图床仓库"></a><h3>3.创建GitHub图床仓库</h3>
<p>创建一个名字为<code>&lt;你github账户名&gt;.github.io</code>的仓库，我这里的是博客使用的仓库，并使用images目录作为图片存放的目录。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216172535.png" alt="创建GitHub图床仓库" title="创建GitHub图床仓库"></p>
<a class="post-dummy-target" id="4生成令牌token"></a><h3>4.生成令牌(Token)</h3>
<p>接下来需要生成令牌，让PicGo插件能通过令牌免密上传图片到图床目录。</p>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216172707.png" alt="生成令牌" title="生成令牌">
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216172915.png" alt="生成令牌" title="生成令牌">
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216173149.png" alt="生成令牌" title="生成令牌">
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216173547.png" alt="生成令牌" title="生成令牌"></p>
<p>Token生成之后要及时复制，之后就无法复制了。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216173745.png" alt="20200216173745.png"></p>
<a class="post-dummy-target" id="5配置picgo插件"></a><h3>5.配置PicGo插件</h3>
<p>打开VsCode上的PicGo插件，点击小齿轮进行配置。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216174042.png" alt="20200216174042.png"></p>
<p>在配置中找到GitHub的相关配置项，从上到下分别配置：图床目录(必须加上/)，github仓库，Token令牌。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216174243.png" alt="配置PicGo插件" title="配置PicGo插件"></p>
<a class="post-dummy-target" id="6测试图床"></a><h3>6.测试图床</h3>
<p>VsCode上的PicGo插件配置好之后，使用<code>Ctrl+Alt+u</code>可以把剪切版中的图片上传到图床中，并且会在当前VsCode打开的文件中生产一个图片的网络链接。同时我们看GitHub上的images目录时，会发现图片被自动上传了。</p>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216185606.png" alt="测试图床" title="测试图床"></p>
<a class="post-dummy-target" id="2-在百度和谷歌上添加网站"></a><h1>2 在百度和谷歌上添加网站</h1>
<a class="post-dummy-target" id="为什么要添加网站"></a><h2>为什么要添加网站</h2>
<p>在百度和谷歌添加博客的网站之后，就可以通过百度和谷歌的搜索引擎找到自己的博客。</p>
<a class="post-dummy-target" id="收录和站点管理"></a><h2>收录和站点管理</h2>
<p>站点收录：让百度或谷歌知道有这个站点的存在，添加之后需要等1~7天（不同搜索引擎不一样）的时间后才能找到自己的博客。</p>
<p>站点管理：向百度或谷歌证明某个站点是属于你的，即你是网站的管理员。可以通过如下方式进行证明：</p>
<ul>
<li>在网站首页中增加一个校验值标签</li>
<li>在网页目录中增加一个校验页面</li>
</ul>
<a class="post-dummy-target" id="添加收录"></a><h2>添加收录</h2>
<p>测试网址是否被收录：site:hts0000.github.io。</p>
<a class="post-dummy-target" id="百度"></a><h3>百度</h3>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216175931.png" alt="检查收录" title="检查收录"></p>
<p>添加之后百度大概需要一星期的时间进行收录。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216180208.png" alt="检查收录" title="检查收录"></p>
<a class="post-dummy-target" id="谷歌"></a><h3>谷歌</h3>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216175823.png" alt="检查收录" title="检查收录"></p>
<p>添加之后谷歌大概需要1~2天的时间来收录网站。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216182402.png" alt="检查收录" title="检查收录"></p>
<p>收录成功后在谷歌中搜索：site:hts0000.github.io，就可以发现我们的网站可以通过浏览器搜索到了。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216185252.png" alt="检查收录" title="检查收录"></p>
<a class="post-dummy-target" id="站点管理"></a><h2>站点管理</h2>
<p>通过百度账号和谷歌账号，可以绑定网站，通过百度和谷歌的统计功能，可以看到网站的访问次数和访问情况。</p>
<p>让账号和网站绑定，需要向百度和谷歌证明你是网站的管理员，证明的方法有很多种，这次选择校验页面的方式进行验证。</p>
<a class="post-dummy-target" id="百度-1"></a><h3>百度</h3>
<p>首先在账号中添加网站
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216182844.png" alt="站点管理" title="站点管理"></p>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216183344.png" alt="站点管理" title="站点管理"></p>
<p>把下载好的校验页面放到网页目录下，向百度证明你是网站的管理员。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216183517.png" alt="站点管理" title="站点管理"></p>
<p>校验成功后可以在站点管理中看到刚刚添加的站点。
<img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216184212.png" alt="站点管理" title="站点管理"></p>
<p>点击站点可以看到百度为我们统计的站点信息，如点击率搜索量等等。</p>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216184322.png" alt="站点管理" title="站点管理"></p>
<a class="post-dummy-target" id="谷歌-1"></a><h3>谷歌</h3>
<p>谷歌的操作与百度类似，也是在网页的目录下添加校验页面，向谷歌证明你是网站的管理员。</p>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216184606.png" alt="站点管理" title="站点管理"></p>
<p>添加完成之后也可以通过谷歌统计的站点信息查看网站的点击量等等。</p>
<p><img src="https://raw.githubusercontent.com/hts0000/hts0000.github.io/master/images/20200216185052.png" alt="站点管理" title="站点管理"></p>
        </div>

        <div class="post-footer" id="post-footer">
    <div class="post-info">
        <div class="post-info-line">
            <div class="post-info-mod">
                <span>本文于 2020-02-16 更新</span>
            </div>
            <div class="post-info-license">
                
            </div>
        </div>
        <div class="post-info-line">
            <div class="post-info-md">
                
            </div>
            <div class="post-info-share">
                
                    <span></span>
                
            </div>
        </div>
    </div>

    <div class="post-info-more">
        <section>
            
                
                    <span class="tag">
                        <a href="https://hts0000.github.io/tags/hugo/"><i class="fas fa-tag fa-fw"></i>hugo</a>
                    </span>
                
                    <span class="tag">
                        <a href="https://hts0000.github.io/tags/%E5%88%86%E4%BA%AB/"><i class="fas fa-tag fa-fw"></i>分享</a>
                    </span>
                
            
        </section>
        <section>
            <span><a href="javascript:window.history.back();">返回</a></span>&nbsp;|&nbsp;<span><a href="https://hts0000.github.io/">主页</a></span>
        </section>
    </div>

    <div class="post-nav">
        
            <a href="https://hts0000.github.io/2020/02/%E5%9F%BA%E4%BA%8Ehugo%E5%BF%AB%E9%80%9F%E6%90%AD%E5%BB%BA%E4%B8%AA%E4%BA%BA%E5%8D%9A%E5%AE%A2/" class="prev" rel="prev" title="基于Hugo快速搭建个人博客"><i class="fas fa-angle-left fa-fw"></i>基于Hugo快速搭建个人博客</a>
        
        
    </div>
</div>

        <div class="post-comment">
            
            

            
        </div>
    </article></div>
            </main>
            <footer class="footer">
    <div class="copyright">
        <div class="copyright-line">
            由 <a href="https://gohugo.io/" target="_blank" rel="external nofollow noopener noreffer">Hugo</a> 强力驱动&nbsp;|&nbsp;主题 - <a href="https://github.com/dillonzq/LoveIt" target="_blank" rel="external nofollow noopener noreffer">LoveIt<i class="far fa-heart fa-fw"></i></a>
        </div>
        <div class="copyright-line">
            <i class="far fa-copyright fa-fw"></i><span itemprop="copyrightYear">2019 - 2020</span><span class="author" itemprop="copyrightHolder">&nbsp;<a href="https://hts0000.github.io/">hts0000</a></span><span class="license">&nbsp;|&nbsp;<a rel="license external nofollow noopener noreffer" href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank">CC BY-NC 4.0</a></span></div>
    </div>
</footer>


    
    




    
    




    
    





    
    



    
    



    
    





    
    





    
    



    
    





    
    




    
    




    
    



    
    





    
    


<script src="/js/lib/jquery/jquery.slim.min.min.js"></script>
<script src="/js/lib/lazysizes/lazysizes.min.min.js"></script>
<script src="/js/lib/smooth-scroll/smooth-scroll.polyfills.min.min.js"></script><script>window.scroll = new SmoothScroll('[data-scroll]', {speed: 300, speedAsDuration: true});</script>


    
    

    

    

    

    






<script src="/js/blog.min.js"></script>


    
</div>
        <a href="#" class="dynamic-to-top" id="dynamic-to-top" data-scroll><span>&nbsp;</span></a>
    </body>
</html>